package com.gong.DesignPattern.ProxyPattern.Dynamic;

import com.gong.DesignPattern.ProxyPattern.static1.Buy;
import com.gong.DesignPattern.ProxyPattern.static1.BuyImpl;

import java.lang.reflect.Proxy;

/**
 * @author GongChang
 * @version 1.0
 * @date 2021/6/22 0022 9:00
 */
public class Test {

    public static void main(String[] args) {
        Buy buy = new BuyImpl();

        Buy buy1 = (Buy) Proxy.newProxyInstance(Test.class.getClassLoader(),new Class[]{Buy.class},new DynamicProxyHandler(buy));

        buy1.buy();
        buy1.sell();
    }
}
